package com.emma.dao;


import com.emma.entity.Address;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;


public interface AddressDao {


    //显示所有数据,分页

    List<Address> findByUid(@Param("condition") Map<String, Object> condition);
    int findCount(@Param("condition") Map<String, Object> condition);

    //添加
    @Insert("insert into tab_address values(null,#{uid},#{contact},#{address},#{telephone},#{isdefault})")
    int add(Address address);
    //修改
    @Update("UPDATE tab_address SET contact=#{contact},address=#{address},telephone=#{telephone} where aid=#{aid}")
    int update(Address address);
    //删除
    @Delete("delete from tab_address where aid=#{aid}")
    int delete(int aid);

    //修改默认地址
    @Update("UPDATE tab_address SET isdefault=0 WHERE uid=#{uid} ")
    int isNotDefault(int uid);
    @Update("UPDATE tab_address SET isdefault=1 WHERE AID=#{aid} ")
    int isDefault(int aid);


}
